<template>
  <div>
    <h2 id="page-heading" data-cy="RoomGoodSearchHeading">
      <span id="room-good-search-heading">Room Good Searches</span>
      <div class="d-flex justify-content-end">
        <button class="btn btn-info mr-2" v-on:click="handleSyncList" :disabled="isFetching">
          <font-awesome-icon icon="sync" :spin="isFetching"></font-awesome-icon> <span>Refresh List</span>
        </button>
        <router-link :to="{ name: 'RoomGoodSearchCreate' }" custom v-slot="{ navigate }">
          <button
            @click="navigate"
            id="jh-create-entity"
            data-cy="entityCreateButton"
            class="btn btn-primary jh-create-entity create-room-good-search"
          >
            <font-awesome-icon icon="plus"></font-awesome-icon>
            <span> Create a new Room Good Search </span>
          </button>
        </router-link>
      </div>
    </h2>
    <br />
    <div class="alert alert-warning" v-if="!isFetching && roomGoodSearches && roomGoodSearches.length === 0">
      <span>No roomGoodSearches found</span>
    </div>
    <div class="table-responsive" v-if="roomGoodSearches && roomGoodSearches.length > 0">
      <table class="table table-striped" aria-describedby="roomGoodSearches">
        <thead>
          <tr>
            <th scope="row"><span>ID</span></th>
            <th scope="row"><span>Bk Room Type</span></th>
            <th scope="row"><span>Bk No</span></th>
            <th scope="row"><span>Title</span></th>
            <th scope="row"><span>Price</span></th>
            <th scope="row"><span>Room Basic</span></th>
            <th scope="row"><span>Room Transaction</span></th>
            <th scope="row"><span>Rent Basic</span></th>
            <th scope="row"><span>Community Id</span></th>
            <th scope="row"><span>Room Features</span></th>
            <th scope="row"><span>Room Sell Point</span></th>
            <th scope="row"><span>Community Introduction</span></th>
            <th scope="row"><span>Room Introduction</span></th>
            <th scope="row"><span>Surrounding Facilities</span></th>
            <th scope="row"><span>Transportation</span></th>
            <th scope="row"></th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="roomGoodSearch in roomGoodSearches" :key="roomGoodSearch.id" data-cy="entityTable">
            <td>
              <router-link :to="{ name: 'RoomGoodSearchView', params: { roomGoodSearchId: roomGoodSearch.id } }">{{
                roomGoodSearch.id
              }}</router-link>
            </td>
            <td>{{ roomGoodSearch.bkRoomType }}</td>
            <td>{{ roomGoodSearch.bkNo }}</td>
            <td>{{ roomGoodSearch.title }}</td>
            <td>{{ roomGoodSearch.price }}</td>
            <td>{{ roomGoodSearch.roomBasic }}</td>
            <td>{{ roomGoodSearch.roomTransaction }}</td>
            <td>{{ roomGoodSearch.rentBasic }}</td>
            <td>{{ roomGoodSearch.communityId }}</td>
            <td>{{ roomGoodSearch.roomFeatures }}</td>
            <td>{{ roomGoodSearch.roomSellPoint }}</td>
            <td>{{ roomGoodSearch.communityIntroduction }}</td>
            <td>{{ roomGoodSearch.roomIntroduction }}</td>
            <td>{{ roomGoodSearch.surroundingFacilities }}</td>
            <td>{{ roomGoodSearch.transportation }}</td>
            <td class="text-right">
              <div class="btn-group">
                <router-link
                  :to="{ name: 'RoomGoodSearchView', params: { roomGoodSearchId: roomGoodSearch.id } }"
                  custom
                  v-slot="{ navigate }"
                >
                  <button @click="navigate" class="btn btn-info btn-sm details" data-cy="entityDetailsButton">
                    <font-awesome-icon icon="eye"></font-awesome-icon>
                    <span class="d-none d-md-inline">View</span>
                  </button>
                </router-link>
                <router-link
                  :to="{ name: 'RoomGoodSearchEdit', params: { roomGoodSearchId: roomGoodSearch.id } }"
                  custom
                  v-slot="{ navigate }"
                >
                  <button @click="navigate" class="btn btn-primary btn-sm edit" data-cy="entityEditButton">
                    <font-awesome-icon icon="pencil-alt"></font-awesome-icon>
                    <span class="d-none d-md-inline">Edit</span>
                  </button>
                </router-link>
                <b-button
                  v-on:click="prepareRemove(roomGoodSearch)"
                  variant="danger"
                  class="btn btn-sm"
                  data-cy="entityDeleteButton"
                  v-b-modal.removeEntity
                >
                  <font-awesome-icon icon="times"></font-awesome-icon>
                  <span class="d-none d-md-inline">Delete</span>
                </b-button>
              </div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <b-modal ref="removeEntity" id="removeEntity">
      <span slot="modal-title"
        ><span id="roomAdminApp.roomGoodSearch.delete.question" data-cy="roomGoodSearchDeleteDialogHeading"
          >Confirm delete operation</span
        ></span
      >
      <div class="modal-body">
        <p id="jhi-delete-roomGoodSearch-heading">Are you sure you want to delete this Room Good Search?</p>
      </div>
      <div slot="modal-footer">
        <button type="button" class="btn btn-secondary" v-on:click="closeDialog()">Cancel</button>
        <button
          type="button"
          class="btn btn-primary"
          id="jhi-confirm-delete-roomGoodSearch"
          data-cy="entityConfirmDeleteButton"
          v-on:click="removeRoomGoodSearch()"
        >
          Delete
        </button>
      </div>
    </b-modal>
  </div>
</template>

<script lang="ts" src="./room-good-search.component.ts"></script>
